package fun.chutianshu.entity;

//抽象类，作为 怪物类 Monster 和 玩家类 Player 的父类
public abstract class Character {
    protected String name;
    protected int ap;
    protected int hp;

    // 添加 x 轴坐标
    private int x;
    // 添加 y 轴坐标
    private int y;

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public Character(String name, int ap, int hp) {
        this.name = name;
        this.ap = ap;
        this.hp = hp;
    }

    public Character(){}

    public Character(String name, int ap, int hp, int x, int y) {
        this.name = name;
        this.ap = ap;
        this.hp = hp;
        this.x = x;
        this.y = y;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAp() {
        return ap;
    }

    public void setAp(int ap) {
        this.ap = ap;
    }

    public int getHp() {
        return hp;
    }

    public void setHp(int hp) {
        this.hp = hp;
    }

    @Override
    public String toString() {
        return "角色{" +
                "name='" + name + '\'' +
                ", ap=" + ap +
                ", hp=" + hp +
                ", x=" + x +
                ", y=" + y +
                '}';
    }

    public abstract void attack(Character character);
}
